<template>
  <div class="app-container">
<!--    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch"-->
<!--             label-width="68px">-->
<!--      <el-form-item label="状态" prop="free30">-->
<!--        <el-select v-model="queryParams.free30" placeholder="请选择状态" clearable size="small">-->
<!--          <el-option-->
<!--            v-for="dict in dict.type.management_class"-->
<!--            :key="dict.value"-->
<!--            :label="dict.label"-->
<!--            :value="dict.value"-->
<!--          />-->
<!--        </el-select>-->
<!--      </el-form-item>-->
<!--      <el-form-item label="管理类别" prop="managementClass">-->
<!--        <el-select v-model="queryParams.managementClass" placeholder="请选择类别" clearable size="small">-->
<!--          <el-option-->
<!--            v-for="dict in dict.type.managementclass"-->
<!--            :key="dict.value"-->
<!--            :label="dict.label"-->
<!--            :value="dict.value"-->
<!--          />-->
<!--        </el-select>-->
<!--      </el-form-item>-->

<!--      <el-form-item label="管理单位" prop="managementUnit">-->
<!--        <el-input-->
<!--          v-model="queryParams.managementUnit"-->
<!--          placeholder="请输入管理单位"-->
<!--          clearable-->
<!--          size="small"-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="名称" prop="designation">-->
<!--        <el-input-->
<!--          v-model="queryParams.designation"-->
<!--          placeholder="请输入名称"-->
<!--          clearable-->
<!--          size="small"-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="有效期">-->
<!--      <el-date-picker-->
<!--        v-model="daterangeNextVerification"-->
<!--        size="small"-->
<!--        style="width: 240px"-->
<!--        value-format="yyyy-MM-dd"-->
<!--        type="daterange"-->
<!--        range-separator="-"-->
<!--        start-placeholder="开始日期"-->
<!--        end-placeholder="结束日期"-->
<!--        unlink-panels-->
<!--      ></el-date-picker>-->
<!--      </el-form-item>-->

      <!--      <el-form-item label="检定周期" prop="verificationCycle">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.verificationCycle"-->
      <!--          placeholder="请输入检定周期"-->
      <!--          clearable-->
      <!--          size="small"-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="末次检定日期" prop="lastVerification">-->
      <!--        <el-date-picker clearable size="small"-->
      <!--                        v-model="queryParams.lastVerification"-->
      <!--                        type="date"-->
      <!--                        value-format="yyyy-MM-dd"-->
      <!--                        placeholder="选择末次检定日期"-->
      <!--        >-->
      <!--        </el-date-picker>-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="有效期" prop="expirationDate">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.expirationDate"-->
      <!--          placeholder="请输入有效期"-->
      <!--          clearable-->
      <!--          size="small"-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="次检定日期" prop="nextVerification">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.nextVerification"-->
      <!--          placeholder="请输入次检定日期"-->
      <!--          clearable-->
      <!--          size="small"-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="溯源单位" prop="traceableUnit">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.traceableUnit"-->
      <!--          placeholder="请输入溯源单位"-->
      <!--          clearable-->
      <!--          size="small"-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="溯源方式" prop="traceableMode">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.traceableMode"-->
      <!--          placeholder="请输入溯源方式"-->
      <!--          clearable-->
      <!--          size="small"-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="证书编号" prop="certificateNumber">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.certificateNumber"-->
      <!--          placeholder="请输入证书编号"-->
      <!--          clearable-->
      <!--          size="small"-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="证书结论" prop="certificateConclusion">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.certificateConclusion"-->
      <!--          placeholder="请输入证书结论"-->
      <!--          clearable-->
      <!--          size="small"-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="确认结论" prop="conclusion">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.conclusion"-->
      <!--          placeholder="请输入确认结论"-->
      <!--          clearable-->
      <!--          size="small"-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="状态" prop="confirmationState">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.confirmationState"-->
      <!--          placeholder="请输入状态"-->
      <!--          clearable-->
      <!--          size="small"-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="测量过程编号" prop="processNumber">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.processNumber"-->
      <!--          placeholder="请输入测量过程编号"-->
      <!--          clearable-->
      <!--          size="small"-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="校准计量" prop="calibrationRecord">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.calibrationRecord"-->
      <!--          placeholder="请输入校准计量"-->
      <!--          clearable-->
      <!--          size="small"-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="加入人员" prop="creator">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.creator"-->
      <!--          placeholder="请输入加入人员"-->
      <!--          clearable-->
      <!--          size="small"-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="加入时间" prop="creationtime">-->
      <!--        <el-date-picker clearable size="small"-->
      <!--                        v-model="queryParams.creationtime"-->
      <!--                        type="date"-->
      <!--                        value-format="yyyy-MM-dd"-->
      <!--                        placeholder="选择加入时间"-->
      <!--        >-->
      <!--        </el-date-picker>-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="完善人员" prop="perfect">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.perfect"-->
      <!--          placeholder="请输入完善人员"-->
      <!--          clearable-->
      <!--          size="small"-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="完善时间" prop="perfecttime">-->
      <!--        <el-date-picker clearable size="small"-->
      <!--                        v-model="queryParams.perfecttime"-->
      <!--                        type="date"-->
      <!--                        value-format="yyyy-MM-dd"-->
      <!--                        placeholder="选择完善时间"-->
      <!--        >-->
      <!--        </el-date-picker>-->
      <!--      </el-form-item>-->
<!--      <el-form-item>-->
<!--        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索-->
<!--        </el-button>-->
<!--        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>-->
<!--      </el-form-item>-->
<!--    </el-form>-->

<!--    <el-row :gutter="10" class="mb8">-->
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="primary"-->
<!--          plain-->
<!--          icon="el-icon-plus"-->
<!--          size="mini"-->
<!--          @click="handleAdd"-->
<!--          v-hasPermi="['meter:ledger:add']"-->
<!--        >新增-->
<!--        </el-button>-->
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="success"-->
<!--          plain-->
<!--          icon="el-icon-edit"-->
<!--          size="mini"-->
<!--          :disabled="single"-->
<!--          @click="handleUpdate"-->
<!--          v-hasPermi="['meter:ledger:edit']"-->
<!--        >修改-->
<!--        </el-button>-->
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="danger"-->
<!--          plain-->
<!--          icon="el-icon-delete"-->
<!--          size="mini"-->
<!--          :disabled="multiple"-->
<!--          @click="handleDelete"-->
<!--          v-hasPermi="['meter:ledger:remove']"-->
<!--        >删除-->
<!--        </el-button>-->
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="warning"-->
<!--          plain-->
<!--          icon="el-icon-download"-->
<!--          size="mini"-->
<!--          @click="handleExport"-->
<!--          v-hasPermi="['meter:ledger:export']"-->
<!--        >导出-->
<!--        </el-button>-->
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-button-->
<!--          type="info"-->
<!--          plain-->
<!--          icon="el-icon-upload2"-->
<!--          size="mini"-->
<!--          @click="handleImport"-->
<!--          v-hasPermi="['meter:ledger:import']"-->
<!--        >导入-->
<!--        </el-button>-->
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-tag type="success">正常:{{queryCount.free20}}</el-tag>-->
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-tag type="warning">警告:{{queryCount.free21}}</el-tag>-->
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-tag type="danger">超期:{{queryCount.free22}}</el-tag>-->
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-tag type="A">A:{{queryCount.free23}}</el-tag>-->
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-tag type="B">B:{{queryCount.free24}}</el-tag>-->
<!--      </el-col>-->
<!--      <el-col :span="1.5">-->
<!--        <el-tag type="C">C:{{queryCount.free25}}</el-tag>-->
<!--      </el-col>-->
<!--      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
<!--    </el-row>-->

    <el-table v-loading="loading" :data="ledgerList" height="720"
              @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center"/>
<!--      <el-table-column label="状态" align="center" prop="free30">-->
<!--        <template slot-scope="scope">-->
<!--          <dict-tag :options="dict.type.management_class" :value="scope.row.free30"/>-->
<!--        </template>-->
<!--      </el-table-column>-->
      <el-table-column label="计量台账编码" align="center" prop="free1"/>
<!--      <el-table-column label="管理类别（A、B、C类）" align="center" prop="managementClass"/>-->
<!--      <el-table-column label="管理单位" align="center" prop="managementUnit"/>-->
<!--      <el-table-column label="名称（命名要最简体现供出方、需求方、介质、用途）" align="center" prop="designation"-->
<!--                       width="350"-->
<!--      />-->
      <el-table-column label="设备类型" align="center" prop="deviceType" width="200"/>

<!--      <el-table-column label="安装位置" align="center" prop="position" width="200"/>-->
<!--      <el-table-column label="测量介质/参数" align="center" prop="storageMedium"/>-->

      <el-table-column label="生产厂家" align="center" prop="brand" width="200"/>
      <el-table-column label="规格型号" align="center" prop="modelNumber"/>
      <el-table-column label="出厂编号" align="center" prop="process"/>

<!--      <el-table-column label="测量范围" align="center" prop="measurementRange"/>-->
<!--      <el-table-column label="误差" align="center" prop="errorMargin"/>-->
<!--      <el-table-column label="属性" align="center" prop="stats" width="200"/>-->

      <el-table-column label="确定间隔" align="center" prop="verificationCycle" width="100"/>
      <el-table-column label="检定日期" align="center" prop="lastVerification" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.lastVerification, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="有效日期" align="center" prop="nextVerification"/>
<!--      <el-table-column label="溯源方式（检定、校准）" align="center" prop="traceableMode"/>-->


      <el-table-column label="溯源单位" align="center" prop="traceableUnit"/>

<!--      <el-table-column label="证书编号" align="center" prop="certificateNumber"/>-->
      <!--      <el-table-column label="证书图片" align="center" prop="area"/>-->
      <el-table-column label="确认结论" align="center" prop="conclusion"/>
      <el-table-column label="月份" align="center" prop="month"/>
      <el-table-column label="是否检定" align="center" prop="calibrated"/>

<!--      <el-table-column label="确认时间" align="center" prop="effect"/>-->
<!--      <el-table-column label="确认人" align="center" prop="powersupplymode"/>-->
<!--      <el-table-column label="状态（在用、送检、限用、停用、准用）" align="center" prop="confirmationState"/>-->
      <!--      <el-table-column label="说明书" align="center" prop="specification"/>-->
<!--      <el-table-column label="执行标准" align="center" prop="instrumentlv"/>-->

<!--      <el-table-column label="完善人员" align="center" prop="perfect"/>-->
<!--      <el-table-column label="完善时间" align="center" prop="perfecttime" width="180">-->
<!--        <template slot-scope="scope">-->
<!--          <span>{{ parseTime(scope.row.perfecttime, '{y}-{m}-{d}') }}</span>-->
<!--        </template>-->
<!--      </el-table-column>-->
<!--      <el-table-column label="图片" align="center" class-name="small-padding fixed-width">-->
<!--        <template slot-scope="scope">-->
<!--          <el-button-->
<!--            v-if="scope.row.area != '' && scope.row.area != null"-->
<!--            size="mini"-->
<!--            type="text"-->
<!--            icon="el-icon-edit"-->
<!--            @click="handlePicture(scope.row)"-->
<!--            v-hasPermi="['meter:ledger:edit']"-->
<!--          >图片-->
<!--          </el-button>-->
<!--        </template>-->
<!--      </el-table-column>-->
<!--      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
<!--        <template slot-scope="scope">-->
<!--          <el-button-->
<!--            size="mini"-->
<!--            type="text"-->
<!--            icon="el-icon-edit"-->
<!--            @click="handleUpdate(scope.row)"-->
<!--            v-hasPermi="['meter:ledger:edit']"-->
<!--          >修改-->
<!--          </el-button>-->
<!--          <el-button-->
<!--            size="mini"-->
<!--            type="text"-->
<!--            icon="el-icon-delete"-->
<!--            @click="handleDelete(scope.row)"-->
<!--            v-hasPermi="['meter:ledger:remove']"-->
<!--          >删除-->
<!--          </el-button>-->
<!--        </template>-->
<!--      </el-table-column>-->
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!-- 添加或修改计量台账对话框 -->
    <!-- 用户导入对话框 -->
    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
      <el-upload
        ref="upload"
        :limit="1"
        accept=".xlsx, .xls"
        :headers="upload.headers"
        :action="upload.url + '?updateSupport=' + upload.updateSupport"
        :disabled="upload.isUploading"
        :on-progress="handleFileUploadProgress"
        :on-success="handleFileSuccess"
        :auto-upload="false"
        drag
      >
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
        <div class="el-upload__tip text-center" slot="tip">
          <div class="el-upload__tip" slot="tip">
            <el-checkbox v-model="upload.updateSupport"/>
            是否更新已经存在的用户数据
          </div>
          <span>仅允许导入xls、xlsx格式文件。</span>
          <el-link type="primary" :underline="false"
                   style="font-size:12px;vertical-align: baseline;"
                   @click="importTemplate"
          >下载模板
          </el-link>
        </div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm">确 定</el-button>
        <el-button @click="upload.open = false">取 消</el-button>
      </div>
    </el-dialog>

  </div>
</template>

<script>
  import {listLedger,listLedgerCount, getLedger, delLedger, addLedger, updateLedger} from '@/api/meter/bb'
  import {getToken} from '@/utils/auth'

  export default {
    name: 'Ledger',
    dicts: ['management_class','managementclass'],

    data() {
      return {
        // 用户导入参数
        upload: {
          // 是否显示弹出层（用户导入）
          open: false,
          // 弹出层标题（用户导入）
          title: '',
          // 是否禁用上传
          isUploading: false,
          // 是否更新已经存在的用户数据
          updateSupport: 0,
          // 设置上传的请求头部
          headers: {Authorization: 'Bearer ' + getToken()},
          // 上传的地址
          url: process.env.VUE_APP_BASE_API + '/meter/ledger/importData'
        },
        // 遮罩层
        loading: true,
        // 选中数组
        ids: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        // 计量台账表格数据
        ledgerList: [],
        // 弹出层标题
        title: '',
        // 是否打开图片弹出层
        pictureOpen: false,
        // 是否显示弹出层
        open: false,
        // 有效期时间范围
        daterangeNextVerification: [],

        queryCount: {
          free20: 0,
          free21: 0,
          free22: 0,
        },
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          managementUnit: null,
          designation: null,
          deviceType: null,
          verificationCycle: null,
          lastVerification: null,
          expirationDate: null,
          nextVerification: null,
          traceableUnit: null,
          traceableMode: null,
          certificateNumber: null,
          certificateConclusion: null,
          conclusion: null,
          confirmationState: null,
          processNumber: null,
          calibrationRecord: null,
          specification: null,
          creator: null,
          creationtime: null,
          perfect: null,
          perfecttime: null,
          deleteor: null,
          deletetime: null

        },
        // 表单参数
        form: {},
        // 表单校验
        rules: {}
      }
    },
    created() {

      var company = this.$route.query.id
      this.queryParams.managementUnit = company
      this.getList()
    },
    methods: {

      handleChange(value) {
        console.log(value)
      },
      /** 查询计量台账列表 */
      getList() {
        this.loading = true
        this.queryParams.params = {};
        if (null != this.daterangeNextVerification && '' != this.daterangeNextVerification) {
          this.queryParams.params["beginNextVerification"] = this.daterangeNextVerification[0];
          this.queryParams.params["endNextVerification"] = this.daterangeNextVerification[1];
        }
        listLedger(this.queryParams).then(response => {
          this.ledgerList = response.rows
          this.total = response.total
          this.loading = false
        })
        listLedgerCount(this.queryParams).then(response => {
          this.queryCount=response.data;
          console.log(this.queryCount)
          // response.data.free20
          // response.data.free21
          // response.data.free22
        })

      },
      // 取消按钮
      cancel() {
        this.open = false
        this.reset()
      },
      // 表单重置
      reset() {
        this.form = {
          projectId: null,
          managementUnit: null,
          area: null,
          process: null,
          position: null,
          storageMedium: null,
          designation: null,
          deviceType: null,
          effect: null,
          brand: null,
          modelNumber: null,
          powersupplymode: null,
          measurementRange: null,
          errorMargin: null,
          instrumentlv: null,
          managementClass: null,
          stats: null,
          dataAcquisition: null,
          acquisitionmode: null,
          verificationCycle: 1,
          lastVerification: null,
          expirationDate: null,
          nextVerification: null,
          traceableUnit: null,
          traceableMode: null,
          certificateNumber: null,
          certificateConclusion: null,
          conclusion: null,
          confirmationState: null,
          processNumber: null,
          calibrationRecord: null,
          specification: null,
          creator: null,
          creationtime: null,
          perfect: null,
          perfecttime: null,
          deleteor: null,
          deletetime: null,
          remark: null,
          createTime: null,
          updateBy: null,
          updateTime: null,
          free1: null,
          free2: null,
          free3: null,
          free4: null,
          free5: null,
          free6: null,
          free7: null,
          free8: null,
          free9: null,
          free11: null,
          free12: null,
          free13: null,
          free14: null,
          free15: null,
          free16: null,
          free17: null,
          free18: null,
          free19: null,
          free20: null,
          free21: null,
          free22: null,
          free23: null,
          free24: null,
          free25: null,
          free26: null,
          free27: null,
          free28: null,
          free29: null,
          free30: null
        }
        this.resetForm('form')
      },
      /** 搜索按钮操作 */
      handleQuery() {
        this.queryParams.pageNum = 1
        this.getList()
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.daterangeNextVerification = [];
        this.resetForm('queryForm')
        this.handleQuery()
      },
      // 多选框选中数据
      handleSelectionChange(selection) {
        this.ids = selection.map(item => item.projectId)
        this.single = selection.length !== 1
        this.multiple = !selection.length
      },
      /** 图片按钮操作 */
      handlePicture(row) {
        this.reset()
        const projectId = row.projectId || this.ids
        console.log(projectId)
        getLedger(projectId).then(response => {
          this.form = response.data
          this.pictureOpen = true
          this.title = '修改图片'
        })

      },
      /** 新增按钮操作 */
      handleAdd() {
        this.reset()
        this.open = true
        this.title = '添加计量台账'
      },
      /** 修改按钮操作 */
      handleUpdate(row) {
        this.reset()
        const projectId = row.projectId || this.ids
        console.log(projectId)
        getLedger(projectId).then(response => {
          this.form = response.data
          this.open = true
          this.title = '修改计量台账'
        })
      },
      /** 提交按钮 */
      submitForm() {
        this.$refs['form'].validate(valid => {
          if (valid) {
            if (this.form.projectId != null) {
              updateLedger(this.form).then(response => {
                this.$modal.msgSuccess('修改成功')
                this.open = false
                this.getList()
              })
            } else {
              addLedger(this.form).then(response => {
                this.$modal.msgSuccess('新增成功')
                this.open = false
                this.getList()
              })
            }
          }
        })
      },
      /** 删除按钮操作 */
      handleDelete(row) {
        const projectIds = row.projectId || this.ids
        this.$modal.confirm('是否确认删除计量台账编号为"' + projectIds + '"的数据项？').then(function () {
          return delLedger(projectIds)
        }).then(() => {
          this.getList()
          this.$modal.msgSuccess('删除成功')
        }).catch(() => {
        })
      },
      /** 导出按钮操作 */
      handleExport() {
        this.download('meter/ledger/export', {
          ...this.queryParams
        }, `ledger_${new Date().getTime()}.xlsx`)
      },
      /** 导入按钮操作 */
      handleImport() {
        this.upload.title = '用户导入'
        this.upload.open = true
      },
      /** 下载模板操作 */
      importTemplate() {
        this.download('meter/ledger/importTemplate', {}, `user_template_${new Date().getTime()}.xlsx`)
      },
      // 文件上传中处理
      handleFileUploadProgress(event, file, fileList) {
        this.upload.isUploading = true
      },
      // 文件上传成功处理
      handleFileSuccess(response, file, fileList) {
        this.upload.open = false
        this.upload.isUploading = false
        this.$refs.upload.clearFiles()
        this.$alert('<div style=\'overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;\'>' + response.msg + '</div>', '导入结果', {dangerouslyUseHTMLString: true})
        this.getList()
      },
      // 提交上传文件
      submitFileForm() {
        this.$refs.upload.submit()
      }

    }
  }
</script>
